<?php
/*
		if(isset($_POST['names'])){
				require '../dbconnect.php';
				$names1 = array($_POST['names']);
				$namekeys = array_keys($names1[0]);
				$student_id = $_POST['student_id'];
					
				foreach ($namekeys as $key) {
					$amountQuery = "SELECT amount FROM paymentplan WHERE id=\"".$key."\"";		
					$amountResult = mysql_query($amountQuery);
					$amount = mysql_result($amountResult, 0);
					
					$paymentquery = sprintf("INSERT INTO payment (student_id, paymentplan_id, datepaid, method, amount)
					VALUES('%s','%s','%s','%s','%s');", 
					mysql_real_escape_string($student_id),
					mysql_real_escape_string($key),
					mysql_real_escape_string(date("Y-m-d")),
					mysql_real_escape_string("Cash"),
					mysql_real_escape_string($amount)
					);
					
					echo $paymentquery."<br/>";	
					//mysql_query($paymentquery);
				}
		
		}
*/
		// payments
			if(isset($_POST['names'])){
				require '../dbconnect.php';
				$names1 = array($_POST['names']);
				$namekeys = array_keys($names1[0]);
				$student_id = $_POST['student_id'];
					
				$payments = 'SELECT * FROM payment WHERE student_id="'.$student_id.'"'; 
				echo $payments;
				}
?>
<h3>Payment added!</h3> <br/>
<a href="generatepayments.php">BACK</a>